import { useStore } from '@/store'

export default function Counter() {
  const count = useStore((s) => s.count)
  const inc = useStore((s) => s.inc)
  
  return (
    <div className="p-4 bg-gray-100 rounded">
      <p className="mb-2 text-lg">全局计数：{count}</p>
      <button 
        onClick={inc}
        className="px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors"
      >
        全局加一
      </button>
    </div>
  )
} 